<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="include/base.jsp" %>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="shortcut icon" href="../img/favicon.ico" >
	<link rel="stylesheet" href="../css/bootstrap.min.css">
	<link rel="stylesheet" href="../css/bootstrap-responsive.css">
	<link rel="stylesheet" href="../css/docs.css">
	<style type="text/css">
		body{
			background:url(../img/b.png);
			
		}
		
	</style>
</head>
<body class="body">
	<% pageContext.setAttribute("left", "data"); %>
	<%@ include file="include/top.jsp" %>
	
	
		
 
 	<!-- 这边是弹出那个编辑框 -->
 		<c:forEach items="${page.list }" var="s">
 			<!-- Modal -->
 			
			<div id="myModal${s.id }" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			  <div class="modal-header">
			    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			    <h3 id="myModalLabel">编辑资料</h3>
			  </div>
			  <form action="editdocument.jspx" method="post">
			  		<div class="modal-body">
					    <h3 style="display:inline">标题：</h3><input type="text" name="title" class="span5" value="${s.title }"/><br/>
					    <h3 style="display:inline">内容：</h3><textarea name="descript" rows="4" cols="" class="span5">${s.content }</textarea>
					  </div>
					  <input type="hidden" value="${s.id }" name="dataid"/>
					  <div class="modal-footer">
					    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
					    <button class="btn btn-primary" type="submit">确定</button>
					  </div>
			  	
			  </form>
			  
			</div>
 		</c:forEach>
 
 
	
	<div class="container">
	  <div class="row">
		<%@ include file="include/left.jsp" %>
		<div class="span9">
			
		 <h1 style="color:#ff7400;margin-bottom:20px;margin-left:15px;display:inline">资料：<a href="newdocument.jspx" style="margin-left:600px;" class="btn btn-large btn-success">分享新资料</a></h1>
		 <hr/>
				
			<div class="wall" style="margin-bottom:20px;">
				<c:if test="${not empty documentmes }">
					<div class="alert alert-success">
		              <button type="button" class="close" data-dismiss="alert">×</button>
		              <strong>${documentmes }</strong>
		            </div>
		            <%
		            	request.getSession().removeAttribute("documentmes");
		            %>
				</c:if>
				
				
				<c:choose>
					<c:when test="${page.totalCount == 0 }">
						<h3 style="color:red">这边还没有任何的共享资料，赶紧共享你的资料吧。。。。</h3>
					</c:when>
					<c:otherwise>
						<c:forEach items="${page.list }" var="s">
							<blockquote style="border-left: 5px solid #58B158">
							  <h3><a href="documentshow.jspx?id=${s.id }">${s.title }</a></h3>
							  <p style="font-size:14px;line-height:1.5;">${s.content }</p>
							  <small style="margin-left:600px;margin-top:15px;">${s.user.username }发布于 ${s.viewcreatetime }</small>
							  <c:if test="${user.id == s.userid }">
							  	&nbsp;&nbsp;<a href="#myModal${s.id }" role="button" data-toggle="modal"><i class="icon-pencil"></i></a>&nbsp;&nbsp;&nbsp;
							  	<a href="javascript:0;" title="删除" class="mya" value="${s.id }"><i class="icon-trash"></i></a>
							  </c:if>
							  
							</blockquote>
						</c:forEach>
					</c:otherwise>
				</c:choose>
				
					
				<c:choose>
					<c:when test="${page.totalCount == 0 }">
						
					</c:when>
					<c:otherwise>
						<%@include file="include/page.jsp" %>
					</c:otherwise>
				</c:choose>
				
				
				<div class="clear"></div>
			</div>
		</div>
	  </div>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			$(".mya").click(function(){
				var dataid = $(this).attr("value");
				if(confirm("你真的确定要删除资料么？")){
					location.href="removedocument.jspx?id="+dataid;
				}
			});
		});
	</script>
</body>
</html>